package com.wfh.picture.service;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.wfh.picture.model.dto.user.UserLoginRequest;
import com.wfh.picture.model.dto.user.UserQueryRequest;
import com.wfh.picture.model.dto.user.UserRegisterRequest;
import com.wfh.picture.model.entity.User;
import com.baomidou.mybatisplus.extension.service.IService;
import com.wfh.picture.model.vo.LoginUserVO;
import com.wfh.picture.model.vo.UserVO;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
* @author lenovo
* @description 针对表【user(用户)】的数据库操作Service
* @createDate 2025-05-07 15:11:13
*/
public interface UserService extends IService<User> {

    /**
     * 用户注册
     * @param userRegisterRequest
     * @return
     */
    Long userRegister(UserRegisterRequest userRegisterRequest);

    String getEncryptPassword(String userPassword);

    /**
     * 用户的登陆
     * @param userLoginRequest
     * @param request
     * @return
     */
    LoginUserVO userLogin(UserLoginRequest userLoginRequest, HttpServletRequest request);

    /**
     * 获得脱敏后的登录用户信息
     * @return
     */
    LoginUserVO getLoginUserVO(User user);

    /**
     * 获取脱敏后的用户信息
     * @param user
     * @return
     */
    UserVO getUserVO(User user);

    /**
     * 获取脱敏后的用户列表
     * @param userList
     * @return
     */
    List<UserVO> getUserVOList(List<User> userList);

    /**
     * 获取当前登录用户
     * @param request
     * @return
     */
    User getLoginUser(HttpServletRequest request);

    /**
     * 用户退出登录
     * @param request
     * @return
     */
    Boolean userLogout(HttpServletRequest request);

    /**
     * 获取查询条件
     * @param userQueryRequest
     * @return
     */
    LambdaQueryWrapper<User> getQueryWrapper (UserQueryRequest userQueryRequest);

    /**
     * 判断用户是否是管理员
     * @param user
     * @return
     */
    Boolean isAdmin(User user);
}
